﻿using GPS.COMMON;
using GPS.Controllers.GPS_NghiepVu;
using GPS.DataAccessLayer;
using GPS.ENTITYS;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace GPS.GPS_DAL
{
    public class GPS_KhoaHocDAO
    {
        /// <summary>
        /// In kế hoạch đào tạo
        /// </summary>
        /// <param name="pDVGTVT_MA"></param>
        /// <param name="pKH_MA"></param>
        /// <returns></returns>
        public DataSet GPS_DAOTAO_KHDT(string pDVGTVT_MA, string pKH_MA)
        {
            DbContextHelper<GPS_NVContext> _db = Singleton<DbContextHelper<GPS_NVContext>>.Inst;
            DataSet datas = OracleHelper.ExecuteDataset(_db.DbContext.Database.Connection.ConnectionString, CommandType.StoredProcedure, "GPS_DAOTAO.GPS_DAOTAO_KHDT1"
                                        , new OracleParameter("PDVGTVT_MA", OracleDbType.Varchar2, string.IsNullOrWhiteSpace(pDVGTVT_MA) ? DBNull.Value : (object)pDVGTVT_MA, ParameterDirection.Input)
                                        , new OracleParameter("PKH_MA", OracleDbType.Varchar2, string.IsNullOrWhiteSpace(pKH_MA) ? DBNull.Value : (object)pKH_MA, ParameterDirection.Input)
                                        , new OracleParameter("PRETHEADER", OracleDbType.RefCursor, ParameterDirection.Output)
                                        , new OracleParameter("PRETKHDT_GIOHOC", OracleDbType.RefCursor, ParameterDirection.Output)
                                        , new OracleParameter("PRETKHDT_LICHHOC", OracleDbType.RefCursor, ParameterDirection.Output)
                                        , new OracleParameter("PRETGVLTHUYET", OracleDbType.RefCursor, ParameterDirection.Output)
                                        , new OracleParameter("PRETGVTHUCHANH", OracleDbType.RefCursor, ParameterDirection.Output)
                                          );

            //var _pDVGTVT_MA = new OracleParameter("PDVGTVT_MA", OracleDbType.Varchar2, (pDVGTVT_MA == null ? DBNull.Value : (object)pDVGTVT_MA), ParameterDirection.Input);
            //var _pKH_MA = new OracleParameter("PKH_MA", OracleDbType.Varchar2, (pKH_MA == null ? DBNull.Value : (object)pKH_MA), ParameterDirection.Input);
            //var _PRETHEADER = new OracleParameter("PRETHEADER", OracleDbType.RefCursor, ParameterDirection.Output);
            //var _PRETKHDT_GIOHOC = new OracleParameter("PRETKHDT_GIOHOC", OracleDbType.RefCursor, ParameterDirection.Output);
            //var _PRETKHDT_LICHHOC = new OracleParameter("PRETKHDT_LICHHOC", OracleDbType.RefCursor, ParameterDirection.Output);
            //var _PRETGVLTHUYET = new OracleParameter("PRETGVLTHUYET", OracleDbType.RefCursor, ParameterDirection.Output);
            //var _PRETGVTHUCHANH = new OracleParameter("PRETGVTHUCHANH", OracleDbType.RefCursor, ParameterDirection.Output);
            //var datas = OracleHelper.ExecuteDataset(GPS_OracleConnectHelper.ConnectionString, CommandType.StoredProcedure
            //                                       , "GPS_DAOTAO.GPS_DAOTAO_KHDT1"
            //                                       , _pDVGTVT_MA
            //                                       , _PRETHEADER
            //                                       , _PRETKHDT_GIOHOC
            //                                       , _PRETKHDT_LICHHOC
            //                                       , _PRETGVLTHUYET
            //                                       , _PRETGVTHUCHANH
            //                                       );

            return datas;
        }
    }
}